//
//  HumanResourceCell.swift
//  HuaYun
//
//  Created by enghou on 2018/12/12.
//  Copyright © 2018 xyxorigation. All rights reserved.
//

import UIKit

class HumanResourceCell: UITableViewCell {

    @IBOutlet weak var typeNameLabel: UILabel!
    @IBOutlet weak var numberOfPeopleLabel: UILabel!
    @IBOutlet weak var peopleCostLabel: UILabel!
    @IBOutlet weak var salaryLabel: UILabel!
    @IBOutlet weak var societyLabel: UILabel!
    private var _model: JSON?
    var model: JSON? {
        get{
            return _model
        }
        set{
            _model = newValue
            self.typeNameLabel.text = _model?.contents?["typeName"]?.rawString()
            self.numberOfPeopleLabel.text = String(_model?.contents?["personAmount"]?.int ?? 0)
            let cost = (_model?.contents?["totalAmount"]?.int ?? 0) / 1000000
            self.peopleCostLabel.text = String(cost)
            let salaryAmount = (_model?.contents?["salaryAmount"]?.int ?? 0) / 1000000
            self.salaryLabel.text = String(salaryAmount)
            let other = (_model?.contents?["otherAmount"]?.int ?? 0) / 1000000
            self.societyLabel.text = String(other)
        }
    }
    
    override func awakeFromNib() {
        super.awakeFromNib()
        // Initialization code
    }

    override func setSelected(_ selected: Bool, animated: Bool) {
        super.setSelected(selected, animated: animated)

        // Configure the view for the selected state
    }
    
}
